{%- if option < 0 %}
{{ indent * level }}else
{{ indent * level }}{
{%- set level = level + 1 -%}
{%- endif %}
{% if add_debug_code == 1 -%}
{{ indent * level }}if (stream->status_callback)
{{ indent * level }}{
{{ indent * (level + 1) }}stream->status_callback({{ type_parameter|upper }}, 0, 0, 0);
{{ indent * level }}}

{% endif -%}
{{ indent * level }}if ({{ index_parameter }} < {{ length_parameter }})
{{ indent * level }}{
{{ indent * (level + 1) }}error = exi_basetypes_encoder_nbit_uint(stream, {{ bits_to_write }}, {{ value_to_write }});
{{ indent * (level + 1) }}if (error == EXI_ERROR__NO_ERROR)
{{ indent * (level + 1) }}{
{{ indent * (level + 2) }}{{ event_comment }}
{{ type_content }}
{{ indent * (level + 1) }}}
{{ indent * level }}}
{%- if is_single_detail %}
{{ indent * level }}else
{{ indent * level }}{
{{ indent * (level + 1) }}error = EXI_ERROR__UNKNOWN_EVENT_CODE;
{{ indent * level }}}
{%- endif %}
{%- if option < 0 %}
{%- set level = level - 1 %}
{{ indent * level }}}
{%- endif %}
